#ifndef WXSGUIFACTORY_H
#define WXSGUIFACTORY_H

#include <wx/string.h>
#include <wx/hashmap.h>

class wxsGUI;
class wxsProject;


class wxsGUIFactory {
  public:


    static wxsGUI* Build( const wxString& Name, wxsProject* Project );


    static wxsGUI* SelectNew( const wxString& Message, wxsProject* Project );


    virtual wxString GetName() { return m_Name; }

  protected:


    wxsGUIFactory( const wxString& Name );


    virtual ~wxsGUIFactory();


    virtual wxsGUI* OnCreate( wxsProject* Project ) = 0;

  private:

    WX_DECLARE_STRING_HASH_MAP( wxsGUIFactory*, GUIItemHashT );

    wxString m_Name;                        ///< \brief GUI name
    static inline GUIItemHashT& GetHash();  ///< \brief Getting hash table
};


template <class T> class wxsRegisterGUI: public wxsGUIFactory {
  public:
    wxsRegisterGUI( const wxString& Name ): wxsGUIFactory( Name ) {}
  protected:
    virtual wxsGUI* OnCreate( wxsProject* Project ) { return new T( Project ); }
};

#endif
